using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Collections;

using DataTransferObject;
using Business;


namespace Presentation.UserControlls
{
    public partial class UC_TKAnPham : UserControl
    {
        clsTapChiDTO tapchiDTO = new clsTapChiDTO();
        clsTapChiBUS tapchiBUS = new clsTapChiBUS();
        clsThuKhoBUS thukhoBUS = new clsThuKhoBUS();

        DataTable tbl = new DataTable();
        BindingSource bs = new BindingSource();
        int tongcong;
        public UC_TKAnPham()
        {
            InitializeComponent();
        }

        private void HienThiListView(DataTable tbl1)
        {
            ListViewItem lvwitem = new ListViewItem();
            lvwthongkeanpham.Items.Clear();
            foreach (DataRow dr in tbl1.Rows)
            {
                tongcong = tongcong + 1;
                lvwitem = new ListViewItem();
                lvwitem.Text = dr["MaTapChi"].ToString();
                lvwitem.SubItems.Add(dr["TenTapChi"].ToString());
                lvwitem.SubItems.Add(dr["TenKy"].ToString());
                lvwitem.SubItems.Add(dr["Ngonngu"].ToString());
                lvwthongkeanpham.Items.Add(lvwitem);
            }


        }
        private void groupPanel1_Click(object sender, EventArgs e)
        {

        }

        private void UC_TKAnPham_Load(object sender, EventArgs e)
        {
            tbl = thukhoBUS.ThuKhoThongKeAnPhamTrongThuVien();
            tongcong = 0;
            HienThiListView(tbl);
            lbltongcong.Text = Convert.ToString(tongcong);
        }

        private void buttonX1_Click(object sender, EventArgs e)
        {
            FromInAn.FrmThongKeTapChi frmintapchi = new Presentation.FromInAn.FrmThongKeTapChi();
            frmintapchi.Show();
        }

        private void buttonX2_Click(object sender, EventArgs e)
        {
            DialogResult dlg = new DialogResult();
            dlg = DevComponents.DotNetBar.MessageBoxEx.Show("Bạn có muốn thoát không ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (dlg == DialogResult.Yes)
            {
                this.ParentForm.Close();
                
            }
        }
    }
}
